<template>
  <div>
    <pageMain padding="0px" v-loading="pageLoading">
      <div class="overall-table-surround">
        <div class="overall-table-surround-options">
          <div class="overall-table-surround-options-left">
            <el-button size="mini" plain type="warning" icon="el-icon-refresh"
              >全选</el-button
            >
            <el-button size="mini" plain type="danger" icon="el-icon-refresh"
              >批量删除</el-button
            >
          </div>
          <div class="overall-table-surround-options-right">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-plus"
              @click="clickAddDic"
              >添加类型</el-button
            >
          </div>
        </div>
        <div class="overall-table-surround-table">
          <el-table
            :size="tableSize"
            :border="tableBorder"
            :data="pageData.list"
          >
            <el-table-column type="selection" width="55" align="center">
            </el-table-column>
            <el-table-column prop="name" label="类型名称"> </el-table-column>
            <el-table-column prop="create_date" label="创建时间" width="180">
            </el-table-column>
            <el-table-column prop="state" label="状态" width="70">
            </el-table-column>
            <el-table-column
              prop="address"
              fixed="right"
              label="操作"
              width="120"
              align="center"
            >
              <template>
                <div class="overall-flex overall-table-options">
                  <el-link type="primary" size="mini" plain>编辑</el-link>
                  <el-link type="danger" size="mini" plain>删除</el-link>
                </div>
              </template></el-table-column
            >
          </el-table>
        </div>
      </div>
    </pageMain>
  </div>
</template>

<script>
import pageMain from "~/page-main/page-main.vue";
import ManageAPI from "@/api/manage";
import tableAttrMixin from "@/mixins/table_attr";
import loadingMixin from "@/mixins/loading";
export default {
  mixins: [tableAttrMixin, loadingMixin],

  components: {
    pageMain,
  },
  data() {
    return {
      pageData: {
        page: 1,
        limit: 10,
        total: 100,
        list: [],
      },
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      this.pageLoading = true;
      ManageAPI.userTypeList()
        .then((res) => {
          console.log(res);

          let { data } = res;

          this.pageData.list = [];
          this.pageData.list = data.list || data.data;
        })
        .catch((err) => {
          console.log(err);
        })
        .finally(() => {
          this.pageLoading = false;
        });
    },
  },
};
</script>

<style></style>
